{include "header.tpl"}

{capture assign=pnm}{$product->name()} {$manufacturer->name()} {$product->model()}{/capture}

<div id='product-details'>
{if count($mainProductImages)}
	<div class="product img-box" style="float:left;">
		<a href="/{$mainProductImages[0].source}" rel="shadowbox[1]" title="{$pnm}">
			<img src='{$mainProductImages[0].url}' alt="{$pnm}" title="{$pnm}"/>
			{if $isNew}
				<div class='newProduct'></div>
			{/if}
		</a>
	</div>
	<div style="float:left; padding-left:10px;">
		{if $product->hasPrice()}
			<dl class='price'>
				<dt>
					{if $product->hasDiscount()}
						<span style="text-decoration: line-through;">
							{$product->priceNoDiscount()}
						</span>	
						&nbsp;&nbsp;
						<span class='newPrice'>
							{$product->price()}
						</span>
					{else}
						{$product->minPrice()}
					{/if}
				</dt>
				<dd>руб</dd>
			</dl>
			<a href="#" class="btn buy"         data-product='{$product->id()}'>КУПИТЬ</a>
			<a href="#" class="btn buy instant" data-product='{$product->id()}'>БЫСТРЫЙ ЗАКАЗ</a>
		{/if}
	</div>
	<div class='product-thumbnails'>
		{foreach $mainProductImages as $thumb}
			{if $thumb@index==0}{continue}{/if}
			<a href="{$thumb.source}" rel="shadowbox[1]" title="{$pnm}">
				<img src='{$thumb.url}' alt="{$nm}" title="{$pnm}">
			</a>
		{/foreach}
	</div>
{/if}
<div style="clear:both; padding-top:10px;">
	<table border=0 cellpadding=6 cellspacing=0>
		{foreach $options as $o}
			{if $o->hasPrice()}
				<tr valign=top>
					<td valign=bottom>
						<h2>{$o->name()}</h2>
					</td>
					<td valign=middle>
						{$o->descr()}
					</td>
					<td valign=middle>
						<dl class='price'>
							<dt>
								{$o->price()}
							</dt>
							<dd>руб</dd>
						</dl>
						
					</td>
					<td valign=middle style="white-space:nowrap;">
						<a href="#" class="btn buy"         data-product='{$product->id()}' data-option='{$o->id()}'>КУПИТЬ</a>
						<a href="#" class="btn buy instant" data-product='{$product->id()}' data-option='{$o->id()}'>БЫСТРЫЙ ЗАКАЗ</a>
					</td>
				</tr>
			{/if}
		{/foreach}
	</table>
</div>
	{if $product->fullDescr()} {$product->fullDescr()} {else} {$product->shortDescr()} {/if}

	{if count($attributes)}
		<br>
		<table class='attr_list'>
			{if $hasOptions && $optionsHaveAttributes}
				<thead style="font-weight:bold;">
					<tr bgcolor="#ffffff">
						<td>
						</td>
						{foreach $attributes as $a}
							<td nowrap>
								{$a[0]}
							</td>
						{/foreach}
					</tr>
				</thead>
			{/if}
			<tbody>
				{foreach $attrNames as $anm}
					<tr bgcolor="#{if $anm@iteration is odd}ffffff{else}daeef7{/if}" data-bg="#{if $anm@iteration is odd}ffffff{else}daeef7{/if}">
						<td style="white-space:nowrap;">
							{$anm}
						</td>
						{foreach $attributes as $a}
							<td>
								{$a[1][$anm@index]->asString()}
							</td>
						{/foreach}
					</tr>
				{/foreach}
			</tbody>
		</table>
	{/if}
</div>

<script>
	$(function(){
		$('.attr_list tbody tr').mouseover(function(){
			$(this).css('background-color','#e3f9ff');
		});
		$('.attr_list tbody tr').mouseout(function(){
			$(this).css('background-color',$(this).attr('data-bg'));
		});
	})
</script>

{if count($products)}
	<br>
	<h3>Вместе с этим товаром покупают</h3>
	{include "components/products.tpl"}
{/if}
<br>

{include "footer.tpl"}